d=#()

for i=1 to b.count do
 (
 if b[i].parent == udefined or b[i] == parentobj then
  (
   join d#(888)
  )
 else
  (
   numtemp=b[i].parent.name
   numtemp2=finditem a numtemp
   join d#(numtemp2)
  )
 )


f = $FK* as array
for i=1 to f.count do
 ( 
  if d[i] == "none" then
   (
   )
  else
   (
    if d[i] == 888 then 
     (
     )
    else
     (
      f[i].parent = f[d[i]]
     )
   )
 )
